package cn.wangsy.zhidao.p20170411;

import java.util.Scanner;

public class text4_7 {

	public static void main(String[] args) {
		Student s1 = new Student("123456", "2", "花花", "女", "20");
		s1.print();
//		reAge a1 = new reAge();
		System.out.println("请输入年龄：");
		Scanner scanner = new Scanner(System.in);
		s1.setAge(scanner.nextLine());
		s1.print();
	}

}

class Student {
	public String id, classId, name, sex, age;

	public Student(String i, String c, String n, String s, String a) {
		id = i;
		classId = c;
		name = n;
		sex = s;
		age = a;
	}

	String getId() {
		return id;
	}

	String getClassId() {
		return classId;
	}

	String getName() {
		return name;
	}

	String getSex() {
		return sex;
	}

	// 修改年龄的方法
	public void setAge(String age){
		this.age = age;
	}
	
	String getAge() {
		return age;
	}

	void print() {
		System.out.println("学号:" + id + "\n班号:" + classId + "\n姓名:" + name
				+ "\n性别:" + sex + "\n年龄:" + age);
	}

}

class reAge {
	String reAge(String a2) {// 修改年龄
		String age = a2;
		return age;
	}

	void print2() {

		// System.out.println("学号:"+id
		// +"\n班号:"+classId
		// +"\n姓名:"+name
		// +"\n性别:"+sex
		// +"\n修改后年龄:"+reAge());
		// }

	}
}
